package controllers

import (
	"xmgl/models"

	//"log"
	"net/http"

	"github.com/astaxie/beego"
)

/*
运维服务，数据统计
*/
type WwfwGdcxController struct {
	beego.Controller
}

func init() {

}

func (this *WwfwGdcxController) Get() {
	var (
		menu models.Menu_gl
		user models.Sut_user
	)
	if this.GetSession("USER") == nil {
		//没有取到session值，页面跳转
		http.Redirect(this.Ctx.ResponseWriter, this.Ctx.Request, "/login", http.StatusFound)
	}
	tmp, ok := this.GetSession("USER").(models.Sut_user) //注意类型断言
	if ok {
		user = tmp
	}
	//log.Println("从session取用户名：", tmp.User_name, "ID：", tmp.User_id)
	//sess := this.StartSession()
	//sess.Set("USER", user)
	//log.Println("从session取用户名：", sess.Get("USER"))

	this.Data["WEBSITE"] = "运维管理/数据统计与分析"
	this.Data["MENU_LEFT"] = menu.Get_left_menu()
	this.Data["MENU_RIGHT"] = menu.Get_right_menu()
	this.Data["USER_NAME"] = user.User_name

	this.Layout = "layout.html"
	this.TplName = "wwfwGdcx.html"
	this.LayoutSections = make(map[string]string)
	this.LayoutSections["HtmlHeader"] = "html_header.html"
}
